<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改密码</title>
    <style>
        .container {
            width: 100%;
            height: 100%;
        }

        .page {
            width: 450px;
            height: 300px;
            margin: auto;
            border: 1px solid gainsboro;
            border-radius: 10px;
            box-shadow: gainsboro 0 0 10px;
            margin-top: 20vh;
        }

        .page form {
            width: 250px;
            margin: auto;
            margin-top: 50px;
        }

        .page div {
            margin-top: 20px;
        }

        input[type=password] {
            width: 250px;
            height: 30px;
            border: none;
            border-bottom: 1px solid rgb(25, 151, 255);
            outline: none;
        }

        input[type=submit] {
            color: #92B4F4;
            background-color: white;
            font-size: 18px;
            border-radius: 5px;
            width: 50%;
            height: 45px;
            padding: 7px 30px;
            margin: 0 auto 25px;
            border: 1px solid #92B4F4 ;
            display: block;
        }

        input[type=submit]:hover{
            background-color: #92B4F4;
            color: white;
            border: 1px solid white;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="page">
            <form action="/root/updatePwd/judge" method="POST" id="updetePwdForm" onsubmit="return submitChange()">
                <div>
                    <label> 密码：</label>
                    <br>
                    <input type="password" required id="password" name="password">
                </div>
                <div>
                    <label>确认密码：</label>
                    <br>
                    <input type="password" required id="repassword" name="repassword">
                </div>
                <div>
                    <input type="submit" value="提交">
                </div>
            </form>
        </div>
    </div>

    <script type="text/javascript" src="/static/js/jquery-3.6.0.min.js"></script>
    <script src="../../static/js/jquery.form.js"></script>
    <script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
    <script>
    var submitChange = function(){
        $("#updetePwdForm").ajaxSubmit(function (message) {
                var messageJson = JSON.parse(message);
                console.log(messageJson); 
                if (messageJson.code === 400) {
                    alert(messageJson.msg);
                   return false;
                } else{
                    alert(messageJson.msg);
                    
                }
            });
            return false;
    }
    </script>
</body>

</html>